﻿// 
// Created By: Xiaofeng.Gu 2021/03/18
// 

#pragma once

#include "Defines.hpp"
#include "CybertronTaskRunnerPoolServer.hpp"

class EventHandlerClientNodeConnection : public SocketEventHandler
{
public:


	EventHandlerClientNodeConnection(CybertronTaskRunnerPoolServer* pServer);
	virtual ~EventHandlerClientNodeConnection();

	virtual void onDisconnected();
	virtual void onMessage(Message& msg);

private:
	void onHandleNodeHeartbeatMessage(Message& msg);
	void onHandleNodeRegisterRequestMessage(Message& msg);
	void onHandleNodeStateMessage(Message& msg);

protected:
	MessageRouter mMessageRouter;
	CybertronTaskRunnerPoolServer* mpServer;
	TaskRunnerPoolClientNode mNodeInfo;
	bool mbReg;
};
